// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.SQLStatement;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "SQLForStatement.h"
#include "../../visitor/SQLASTVisitor.h"
#include "../../../utils/listTran.h"
#include "../SQLName.h"

SQLForStatement::SQLForStatement()
{
  statements = std::make_shared<std::list<SQLStatement_ptr>>();
}

SQLName_ptr SQLForStatement::getIndex()
{
  return index;
}

void SQLForStatement::setIndex(SQLName_ptr index)
{
  this->index = index;
}

SQLExpr_ptr SQLForStatement::getRange()
{
  return range;
}

void SQLForStatement::setRange(SQLExpr_ptr range)
{
  if (range != nullptr)
  {
    range->setParent(SharedObject(SQLForStatement));
  }
  this->range = range;
}

SQLStatement_list_ptr SQLForStatement::getStatements()
{
  return statements;
}

// @Override
void SQLForStatement::accept0(SQLASTVisitor_ptr v)
{
  if (v->visit(SharedObject(SQLForStatement)))
  {
    acceptChild(v, index);
    acceptChild(v, range);
    SQLObject_list_ptr tmp1 = ListTran::tran_class<SQLStatement, SQLObject>(statements);
    acceptChild(v, tmp1);
  }
  v->endVisit(SharedObject(SQLForStatement));
}
